package light.head.model.el;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;
/**
 * 课程表
 */
@Table
@Entity
public class Course implements Serializable{
	
	private static final long serialVersionUID = 4398413456886738390L;
	private Integer code;
	private String name;				//课程名称
	private Date ct;					//创建时间
	private Integer oc;					//创建机构
	private Integer cu;					//创建人编号
	private Boolean deleted = false;	//是否删除
	
	private List<FrontCourse> itemList;	// 前置课程
	private List<CourseLecturer> lcList;// 讲师		
	private String on;					//创建机构名称
	private String cn;					//创建人名称
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public String getName() {
		return name;
	}
	public Date getCt() {
		return ct;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code=oc)")
	public String getOn() {
		return on;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code=cu)")
	public String getCn() {
		return cn;
	}
	@Transient
	public List<CourseLecturer> getLcList() {
		return lcList;
	}
	@Transient
	public List<FrontCourse> getItemList() {
		return itemList;
	}
	
	
	
	
	public void setLcList(List<CourseLecturer> lcList) {
		this.lcList = lcList;
	}
	
	public void setItemList(List<FrontCourse> itemList) {
		this.itemList = itemList;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setOn(String on) {
		this.on = on;
	}
	public void setCn(String cn) {
		this.cn = cn;
	}
	
	
	
	
	
}
